<template>
    <rx-layout>
        <template #middle>
          <rx-grid ref="table"
                   :hasPage="true"
                   :urlConfig="urlConfig"
                   :selectConfig="selectConfig"
                   url="/api-form/form/core/formDownloadRecord/query"
                   field="id"
                   :columns="columns"
          >
            </rx-grid>
        </template>
    </rx-layout>
</template>

<script>
import FormDownloadRecordApi from '@/common/api/form/formDownloadRecord'
import FormDownloadRecordEdit from './FormDownloadRecordEdit.vue'
import {BaseList, RxFit, RxGrid} from '@lowcode/jpaas-base-lib';

export default {
    name: 'FormDownloadRecordList',
    mixins: [BaseList],
    components: {
        RxFit
    },
    props:["selectGenTaskId"],
    data() {
        return {
            urlConfig: {
              ajaxType: 'post',
              contentType: 'json',
              queryParam: {},
              dataField: 'result.data',
              totalField: 'result.totalCount'
            },
            selectConfig: {
              type: 'checkbox',
            },
            columns: [
                {title: this.i18n('form.downloader','下载人'), field: 'createByName', minWidth: 120},
                {title: this.i18n('form.downloadTime','下载时间'), field: 'createTime', minWidth: 200}
            ],
            component: FormDownloadRecordEdit,
            comment: this.i18n('list.comment','Excel下载记录(异步)'),
            widthHeight: ['800px', '600px'],
        }
    },
    created() {
        if(this.selectGenTaskId){
            this.urlConfig.queryParam["Q_GEN_RECORD__S_EQ"]=this.selectGenTaskId;
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"FormDownloadRecord",key);
        },
        delById(ids) {
            return FormDownloadRecordApi.del({ids: ids.join(',')});
        },
    },
    watch:{
        "selectGenTaskId":function (val,oldval){

            if(!val){
                return;
            }
            this.urlConfig.queryParam["Q_GEN_RECORD__S_EQ"]=val;
            this.$refs.table.loadData()
        }
    }
}
</script>
<style scoped>

</style>

